﻿using Microsoft.AspNetCore.Mvc.Filters;

namespace Warehouse.Api.Read
{
    public class exception : IExceptionFilter
    {
        public readonly ILogger<exception> logger;

        public exception(ILogger<exception> logger)
        {
            this.logger = logger;
        }

        public void OnException(ExceptionContext context)
        {
            logger.LogError("发生全局异常" + context.Exception.Message);
            context.ExceptionHandled = true;
        }
    }
}
